<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        #demo {
            width: 500px;
            height: 100px;
            background: #ccc;
            overflow: hidden;
            white-space: nowrap; /*强制不换行*/
        }

        #one {
            width: 800px;
            height: 100px;
        }
        img{
            width: 100px;
            height: 100px;
        }
    </style>
</head>
<body>
<div id="demo">
       <span id="one">
            <img src="01-flower.png"/>
            <img src="02-coffee.png"/>
            <img src="03-good.png"/>
            <img src="04-applaud.png"/>
            <img src="05-666.png"/>
            <img src="06-star.png"/>
            <img src="08-car.png"/>
            <img src="09-rocket.png"/>
       </span>
    <span id="two"></span>
</div>
<script>
    var demo = document.getElementById("demo");
    var one = document.getElementById("one");
    var two = document.getElementById("two");
    two.innerHTML=one.innerHTML;
    function f() {
        if (demo.scrollLeft>=demo.scrollWidth/2){
            demo.scrollLeft=0;
        }else{
            demo.scrollLeft+=2;
        }
    }
    setInterval(f,10);
</script>
</body>
</html>